var app = getApp()
const requireHttps = app.globalData.requireHttps //获取require域名
Page({
  data: {
    address: '',
    usable: '',
    name: '',
    showParking: true
  },
  onLoad: function() {
    let _this = this;
    _this.getPriking()
  },
  goParkingTxzl: e => {
    app.globalData.parkingid = e.currentTarget.dataset.gp_id
    // app.globalData.describe = e.currentTarget.dataset.describe
    wx.navigateTo({
      url: '/pages/parkingTxzl/parkingTxzl',
    })
  },
  getPriking: function() {
    wx.showLoading({
      title: '加载中',
      mask: true
    })
    let _this = this;
    wx.request({
      url: '' + requireHttps + '/api/garage/getGarageParking',
      data: {
        g_id: app.globalData.garageid,
        page: 1,
        token: app.globalData.token
      },
      method: 'post',
      success: res => {
        // console.log(res)
        if (res.data.data == ''){
          _this.setData({
            noParking: '暂无车位',
            showParking: false
          })
        }
        _this.setData({
          address: app.globalData.address,
          usable: app.globalData.usable,
          name: app.globalData.name,
          juli: app.globalData.juli,
          myParking: res.data.data
        })
        wx.hideLoading()
      }
    })
  }
})